package cn.retalsystem.service.impl;

import cn.retalsystem.bean.User;
import cn.retalsystem.dao.UserMapper;
import cn.retalsystem.service.UserService;
import cn.retalsystem.vo.UserVo;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 王劲威
 * @Date: 2019/11/2 12:57
 * @Version 1.0
 * @描述：
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public List<UserVo> selectAllUsers(String username) {
        return userMapper.selectAll(username);
    }

    @Override
    public List<UserVo> getallUsers(Integer page, Integer limit,String username) {
        PageHelper.startPage(page,limit);
        List<UserVo> userVoList = userMapper.selectAll(username);
        return userVoList;
    }

    @Override
    public int getCount(String username) {
        int size = userMapper.selectAll(username).size();
        return size;
    }

    @Override
    public Integer DeleteUsers(Integer id) {
        int i = userMapper.deleteByPrimaryKey(id);
        return i;
    }
}
